import os
import re

path="/home/gehongfei/project/data/images"
a = os.listdir(path)
for i in a:
    print(i)
    try:
        if i.endswith('png'):
            print(1)
            filename = i.split('.')[0]
            new_filename = filename + '.jpg'
            src = os.path.join(path,i)
            des = os.path.join(path,new_filename)
            os.rename(src,des)
    except Exception as e:
        print(e)
print(len(a))

# for i in a:
#     #print(i)
#     if i == 'B00B26AWG8.jpg':
#         print(i)
